package com.ringtheweb.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

import org.hibernate.annotations.Parent;

@Embeddable
public class UserStatus implements Serializable{
	
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	@Enumerated(EnumType.STRING)
	@Column(name="TYPE",nullable=false)
	private UserStatusType type;
	
	@Column(name="MESSAGE",nullable=true)
	private String message;
	
	@Parent
	private User user;
	
	private UserStatus() {
	}
	
	public UserStatus(UserStatusType type) {
		this.type = type;
	}

	public UserStatus(String message, UserStatusType type) {
		this.message = message;
		this.type = type;
	}

	public UserStatusType getType() {
		return type;
	}

	public String getMessage() {
		return message;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == this) {
			return true;
		}
		if (!(obj instanceof UserStatus)) {
			return false;
		}
		UserStatus userStatus = (UserStatus)obj;
		
		return type == userStatus.getType();
	}

	@Override
	public int hashCode() {
		return type.hashCode();
	}
	
	
	
	
	
	
	

}
